#include "../common/global.h"
#include "ui.h"

ui_globals_t ui;

void init_ui(void)
{
	if (TTF_Init() == -1)
		com_fatal("TTF_Init");

	//载入字体
	char font_path[MAX_OSPATH+10] = "../data/font/";
	strcat(font_path, font_file);
	ui.font = TTF_OpenFont(font_path, font_size);
	if (ui.font == NULL)
		com_fatal("TTF_OpenFont");
	ui.text_color.r = 255;
	ui.text_color.g = 255;
	ui.text_color.b = 255;

	//创建ui层
	ui.layer = SDL_CreateRGBSurface(SDL_SWSURFACE, screen_width, screen_height, 32,0,0,0,0);
	ui.transparent = SDL_MapRGBA(ui.layer->format, 0, 0, 0, 255);
	//SDL_SetAlpha(ui.layer, 0, 128);
}

void show_ui(void)
{
	//SDL_FillRect(ui.layer, NULL, ui.transparent);

	//ui_show_msg("我是中国人！");
	//SDL_SetAlpha(ui.layer, SDL_SRCALPHA, 0);

	//rd_apply_surface(0, 0, ui.layer, rd.screen, NULL);
}

void release_ui(void)
{
	TTF_CloseFont(ui.font);
	TTF_Quit();
}

